package com.hpc.Controller;

import Utils.JSONUtil;
import Utils.ResultUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/ts/article/rpc")
public class RPCController {
    @Resource
    private com.hpc.Service.articleService articleService;
    @GetMapping("/getAllArticleByUserId")
    public String getAllArticleByUserId(@RequestParam("userId") String userId,@RequestParam("isNeedFilter") boolean isNeedFilter){
        return JSONUtil.toJSONString(articleService.allArticleByUserId(userId,isNeedFilter));
    }
    @GetMapping("/deleteArticle")
    public String deleteArticle(String articleId){
        boolean b = articleService.deleteArticle(articleId);
        if (b){
            return JSONUtil.toJSONString(ResultUtil.success());
        }else {
            return JSONUtil.toJSONString(ResultUtil.error("删除失败！"));
        }
    }
}
